/*
 * @Author: Yonyou
 * @Date: 2020-03-11 11:10:28
 * @LastEditTime: 2020-09-15 14:41:10
 * @LastEditors: hanfengmi
 * @Description: 全局数据store
 */
import { 
  GetName
} from '@/service/home'
export default {
  namespace: 'home',
  
  state: {
    name: 'xixi'
  },
  effects: {
    *GetName({ payload,callback }, { call,put }) {
      const response = yield call(GetName,payload)
      if(response.success) {
        yield put({
          type: 'save',
          payload: {
            name: payload.name
          }
        })
        callback && callback()
      }else {
        // error()
      }
    }
  },
  
  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload
      }
    }
  }
}
  